package com.example.common;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class Result {

    private static final String SUCCESS = "0";
    private static final String ERROR = "-1";

    private String code;
    private String msg;
    private Object data;

    public static Result success(){
        Result success = new Result();
        success.setCode(SUCCESS);
        return success;
    }

    public static Result success(Object data){
        Result success = new Result();
        success.setCode(SUCCESS);
        success.setData(data);
        return success;
    }

    public static Result error(String msg){
        Result success = new Result();
        success.setCode(ERROR);
        success.setMsg(msg);
        return success;
    }

}
